package com.joe.learn.apidoc;

import lombok.Data;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Controller
public class Api {

    /**
     * @api {POST} /getPerson getPerson
     * @apiVersion 1.0.0
     * @apiGroup Api
     * @apiName getPerson
     * @apiParam (请求体) {Number} id id
     * @apiParamExample 请求体示例
     * {"id":4742}
     * @apiSuccess (响应结果) {Number} id id
     * @apiSuccess (响应结果) {String} name 姓名
     * @apiSuccessExample 响应结果示例
     * {"name":"iLiKgM3AY","id":4742}
     */
    /**
     * @api {POST} /getPerson getPerson
     * @apiVersion 1.0.1
     * @apiGroup Api
     * @apiName getPerson
     * @apiParam (请求体) {Number} id id
     * @apiParamExample 请求体示例
     * {"pid":4742}
     * @apiSuccess (响应结果) {Number} id id
     * @apiSuccess (响应结果) {String} name 姓名
     * @apiSuccessExample 响应结果示例
     * {"name":"iLiKgM3AY","id":4742}
     */
    /**
     * @api {POST} /getPerson getPerson
     * @apiVersion 1.0.2
     * @apiGroup Api
     * @apiName getPerson
     * @apiParam (请求体) {Number} id i211
     * @apiParam (请求体) {String} name 姓名2
     * @apiParamExample 请求体示例
     * {"name":"rriV66iP","id":6231}
     * @apiSuccess (响应结果) {Number} id id
     * @apiSuccess (响应结果) {String} name 姓名
     * @apiSuccessExample 响应结果示例
     * {"name":"11","id":675}
     */
    @PostMapping("/getPerson")
    public Person getPerson(@RequestBody Person person) {
        return person;
    }

    @Data
    static class Person {
        /**
         * id
         */
        private Integer id;

        /**
         * 姓名
         */
        private String name;
    }

}
